#include "Enemy.h"
#include "Game.h"

Enemy::Enemy(SpawnInfo spawnInfo) : Entity(spawnInfo)
{
	// Default enemy points value
	pointsValue = 10001;
}

Enemy::~Enemy()
{
}

bool Enemy::advance(int targetDistance)
{
	Player* p = Game::getInstance()->getPlayer();

	int distance = abs(p->getX() - x);

	if(distance < targetDistance)
	{
		return true;
	}
	else
	{
		if(p->getX() < x){
			moveLeft();
			flipped = true;
		}

		if(p->getX() > x){
			moveRight();
			flipped = false;
		}

		return false;
	}
}
